package com.txunda.zhuohired.adapter.manage.home;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.txunda.zhuohired.R;
import com.txunda.zhuohired.bean.manage.home.ManageAllBean;

import java.util.List;

/**
 * 创建人： Txd_Cjh
 * 创建时间： 2018/3/10 16:29
 * 功能描述：全部职位adapter
 * 联系方式：jiahuanchen@126.com
 */

public class ManageAllAdapter extends BaseAdapter {
    private Context context;
    private ViewHolder holder;
    private List<ManageAllBean.DataBean> mList;

    public ManageAllAdapter(Context context, List<ManageAllBean.DataBean> manageList) {
        this.context = context;
        this.mList = manageList;
    }

    @Override
    public int getCount() {
        return mList.size();
    }

    @Override
    public Object getItem(int i) {
        return mList.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        if (view == null) {
            view = LayoutInflater.from(context).inflate(R.layout.item_manage_all, null);
            holder = new ViewHolder();
            view.setTag(holder);
            ViewUtils.inject(holder, view);
        } else {
            holder = (ViewHolder) view.getTag();
        }
        holder.tv_manage_name.setText(mList.get(i).getName());
        holder.tv_manage_see_num.setText(mList.get(i).getSee_num());
        holder.tv_manage_talk_num.setText(mList.get(i).getTalk_num());
        holder.tv_manage_turn_num.setText(mList.get(i).getTurn_num());
        return view;
    }

    class ViewHolder {
        @ViewInject(R.id.tv_manage_name)
        TextView tv_manage_name;//工作名称
        @ViewInject(R.id.tv_manage_talk_num)
        TextView tv_manage_talk_num;//沟通次数
        @ViewInject(R.id.tv_manage_see_num)
        TextView tv_manage_see_num;//查看次数
        @ViewInject(R.id.tv_manage_turn_num)
        TextView tv_manage_turn_num;//转发次数
    }
}
